package com.example.grpc.userpage;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 *定义服务
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: UserPage.proto")
public final class UserPagesGrpc {

  private UserPagesGrpc() {}

  public static final String SERVICE_NAME = "UserPages";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getListMethod()} instead. 
  public static final io.grpc.MethodDescriptor<com.example.grpc.userpage.UserPageRequest,
      com.example.grpc.userpage.UserPageResponse> METHOD_LIST = getListMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.example.grpc.userpage.UserPageRequest,
      com.example.grpc.userpage.UserPageResponse> getListMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.example.grpc.userpage.UserPageRequest,
      com.example.grpc.userpage.UserPageResponse> getListMethod() {
    return getListMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.example.grpc.userpage.UserPageRequest,
      com.example.grpc.userpage.UserPageResponse> getListMethodHelper() {
    io.grpc.MethodDescriptor<com.example.grpc.userpage.UserPageRequest, com.example.grpc.userpage.UserPageResponse> getListMethod;
    if ((getListMethod = UserPagesGrpc.getListMethod) == null) {
      synchronized (UserPagesGrpc.class) {
        if ((getListMethod = UserPagesGrpc.getListMethod) == null) {
          UserPagesGrpc.getListMethod = getListMethod = 
              io.grpc.MethodDescriptor.<com.example.grpc.userpage.UserPageRequest, com.example.grpc.userpage.UserPageResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "UserPages", "list"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.example.grpc.userpage.UserPageRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.example.grpc.userpage.UserPageResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new UserPagesMethodDescriptorSupplier("list"))
                  .build();
          }
        }
     }
     return getListMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static UserPagesStub newStub(io.grpc.Channel channel) {
    return new UserPagesStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static UserPagesBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new UserPagesBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static UserPagesFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new UserPagesFutureStub(channel);
  }

  /**
   * <pre>
   *定义服务
   * </pre>
   */
  public static abstract class UserPagesImplBase implements io.grpc.BindableService {

    /**
     */
    public void list(com.example.grpc.userpage.UserPageRequest request,
        io.grpc.stub.StreamObserver<com.example.grpc.userpage.UserPageResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getListMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getListMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.example.grpc.userpage.UserPageRequest,
                com.example.grpc.userpage.UserPageResponse>(
                  this, METHODID_LIST)))
          .build();
    }
  }

  /**
   * <pre>
   *定义服务
   * </pre>
   */
  public static final class UserPagesStub extends io.grpc.stub.AbstractStub<UserPagesStub> {
    private UserPagesStub(io.grpc.Channel channel) {
      super(channel);
    }

    private UserPagesStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected UserPagesStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new UserPagesStub(channel, callOptions);
    }

    /**
     */
    public void list(com.example.grpc.userpage.UserPageRequest request,
        io.grpc.stub.StreamObserver<com.example.grpc.userpage.UserPageResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getListMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   *定义服务
   * </pre>
   */
  public static final class UserPagesBlockingStub extends io.grpc.stub.AbstractStub<UserPagesBlockingStub> {
    private UserPagesBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private UserPagesBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected UserPagesBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new UserPagesBlockingStub(channel, callOptions);
    }

    /**
     */
    public com.example.grpc.userpage.UserPageResponse list(com.example.grpc.userpage.UserPageRequest request) {
      return blockingUnaryCall(
          getChannel(), getListMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   *定义服务
   * </pre>
   */
  public static final class UserPagesFutureStub extends io.grpc.stub.AbstractStub<UserPagesFutureStub> {
    private UserPagesFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private UserPagesFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected UserPagesFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new UserPagesFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.example.grpc.userpage.UserPageResponse> list(
        com.example.grpc.userpage.UserPageRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getListMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_LIST = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final UserPagesImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(UserPagesImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_LIST:
          serviceImpl.list((com.example.grpc.userpage.UserPageRequest) request,
              (io.grpc.stub.StreamObserver<com.example.grpc.userpage.UserPageResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class UserPagesBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    UserPagesBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.example.grpc.userpage.UserPageOuterClass.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("UserPages");
    }
  }

  private static final class UserPagesFileDescriptorSupplier
      extends UserPagesBaseDescriptorSupplier {
    UserPagesFileDescriptorSupplier() {}
  }

  private static final class UserPagesMethodDescriptorSupplier
      extends UserPagesBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    UserPagesMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (UserPagesGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new UserPagesFileDescriptorSupplier())
              .addMethod(getListMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
